<!doctype html>
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/mobile/include/include.jsp"%>
<%
    response.setHeader("Cache-Control", "no-store");
    response.setHeader("Pragrma", "no-cache");
    response.setDateHeader("Expires", 0);
%>
<html lang="cn">
<head>
<%@ include file="/jsp/mobile/include/header.jsp"%>
<title>收益总额</title>
</head>

<body>
	<div class="main">		
		<form id="spForm"
			action="<%=request.getContextPath()%>/mobile/sprofit/transferShareProfit">
			<token:tokenTag></token:tokenTag>
			<div class="ciTab mt15">
				<ul>
					<li><span class="tit">收益余额</span> <span class="f14 red">￥<fmt:formatNumber
								pattern="#,##0.00"
								value="${null == temp.sprofitAvlAmt?0.00:temp.sprofitAvlAmt}" /> </span> <input
						type="hidden" name="avlBal" id="avlBal"
						value="<c:out value='${null == temp.sprofitAvlAmt?0.00:temp.sprofitAvlAmt}' />">
					</li>
				</ul>
			</div>
			<div class="ciTab mt15">
				<ul>
					<li><span class="tit">转出金额</span> <input type="number"
						onfocus="" name="tradeAmt" id="tradeAmt" class="text"
						placeholder="输入转出金额" autocomplete="off">
					</li>
					<li><span class="tit">支付密码</span> <input name="tradePwd"
						id="tradePwd" type="password" class="text" placeholder="输入支付密码"
						autocomplete="off" maxlength="6">
					</li>
				</ul>
			</div>

			<div class="ctix">
				<p class="f14">温馨提示：</p>

				<p class="gray9 mt5">1.收益余额为您推荐客户消费产生的利润返佣；</p>

				<p class="gray9 mt5">2.收益余额需转出至钱包账户余额，才能做消费或取现。</p>
			</div>
			<div class="payOk mb20">
				<div class="nbtn mt20">
					<a class="butn butn-gray" id="confirmAmt"
						href="javascript:enchash();">确认</a>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		$(document).ready(function() {
			changeStyleByValue();
		});
		function enchash() {
			var _tradeAmt = $("#tradeAmt").val();
			var _tradePwd = $("#tradePwd").val();
			var _avlBal = $("#avlBal").val();
			var _msg = "";
			
			if (parseFloat(_tradeAmt) > parseFloat(_avlBal)) {
				_msg += "转出金额超出可用余额";
			}

			if (_tradePwd == "") {
				_msg += "请输入支付密码";
			}
			if (_msg == "") {
				$("#confirmAmt").removeAttr("href");
				$("#spForm").submit();
			} else {
				window.openMsg(_msg, 3);
			}
		}		

		$("#tradeAmt").bind("focus", function() {
			$(this).removeAttr("placeholder");
		});

		$("#tradeAmt").bind("blur", function() {
			if ($(this).val() == '') {
				$(this).attr("placeholder", "输入转出金额");
			}
		});

		$("#tradePwd").bind("focus", function() {
			$(this).removeAttr("placeholder");
		});

		$("#tradePwd").bind("blur", function() {
			if ($(this).val() == '') {
				$(this).attr("placeholder", "输入支付密码");
			}
		});

		$("#tradeAmt").bind("input propertychange", function() {
			//这里写当input的文字(text)发生改变时所执行的代码！
			changeStyleByValue();
		});

		function changeStyleByValue() {
			var _amt = $("#tradeAmt").val();
			if (checkPrice(_amt) && parseFloat(_amt) > 0) {
				$("#confirmAmt").removeClass("butn-gray").attr("href",
						"javascript:enchash();");
			} else {
				$("#confirmAmt").addClass("butn-gray").removeAttr("href");
			}
		}
	</script>
</body>
</html>